using System;
using CI.Interfaces;
using System.Runtime.Serialization;

namespace CI.Organism
{
    /// <summary>Base Reproductive Gene class</summary>
    [DataContract]
    public abstract class GeneReproduction : Gene
    {
        /// <summary>Mutation Rate eg, 7.83%</summary>
        [DataMember]
        public double MutationRate { get; set; }

        /// <summary>The Resulting child Organism after the reproduction</summary>
        public IOrganism ChildOrganism { get; set; }

        /// <summary>
        /// Gene Reproduction class
        /// </summary>
        /// <param name="organism">Organism the gene belongs to</param>
        /// <param name="guid">Gene Guid</param>
        public GeneReproduction(IOrganism organism, Guid guid) : base(organism, guid) { }



        /// <summary>
        /// do a equals comparison of one gene type to another only comparing the value types, no refference comparisons
        /// </summary>
        /// <param name="gene">gene to compare against</param>
        /// <returns>true if equal value types</returns>
        public override bool EqualsValueTypes(IGene gene)
        {
            // compare the mutation rate
            if (this.MutationRate != ((GeneReproduction)gene).MutationRate)
                return false;

            // check the base class
            return base.EqualsValueTypes(gene);
        }
    }
}


